package com.jshcbd.modules.asset.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jshcbd.framework.annotation.Dict;
import com.jshcbd.modules.asset.dto.ReceiveDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @author zhoucd
 * @date
 * @description
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel( description = "资产领用记录")
@TableName("receive")
public class ReceiveEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    private String id;

    public ReceiveEntity(ReceiveDto master){
        BeanUtils.copyProperties(master,this);
    }

    public ReceiveEntity(){

    }

    @ApiModelProperty(value = "领用人",required=true)
    @NotNull
    private String receiver;

    @ApiModelProperty(value = "领用日期",required=true)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date receiveDate;

    @ApiModelProperty(value = "联系电话",required=true)
    private String telphone;

    @ApiModelProperty(value = "公司Id",required=true)
    private String companyId;

    @ApiModelProperty(value = "总价格",required=true)
    private BigDecimal sumPrice;


    @ApiModelProperty(value = "归还期限",required=true)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @NotNull
    private Date dueDate;

    @ApiModelProperty(value = "单位楼")
    @Dict(dicCode = "building")
    private Integer locationBuilding;

    @ApiModelProperty(value = "楼层")
    private Integer locationFloor;


    @ApiModelProperty(value = "备注")
    private String  note;

    @ApiModelProperty(value = "领用类型(1:领用/2:转移/3:续期)")
    private Integer type;


    /**
     * 更新人
     */
    @ApiModelProperty(value = "更新人")
    private String updateBy;
    /**
     * 更新时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;
    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    private String createBy;
    /**
     * 创建时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;


}
